package com.ade.warehouse.page;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 页面跳转
 */
@Controller
public class PageController {

	/**
	 * 后台管理首页访问路径
	 */
	@RequestMapping("/admin")
	public String showIndex() {
		return "index";
	}

	@RequestMapping("/{page}")
	public String showPage(@PathVariable String page) {
		return page;
	}

	/**
	 * 后台管理系统模块访问路径
	 */
	@RequestMapping("/admin/sys/{module}/{page}")
	public String accessSysPage(@PathVariable String module, @PathVariable String page) {
		return module + "/" + page;
	}

	/**
	 * 后台管理物联网监控模块访问路径
	 */
	@RequestMapping("/admin/iftmonitor/{module}/{page}")
	public String accessIftmonitorPage(@PathVariable String module, @PathVariable String page) {
		return "iftmonitor/" + module + "/" + page;
	}

	/**
	 * 后台管理物联网监控模块子模块访问路径
	 */
	@RequestMapping("/admin/iftmonitor/{module}/{page}/{subPage}")
	public String showModuleSubPage(@PathVariable String module, @PathVariable String page, @PathVariable String subPage) {
		return "iftmonitor/" + module + "/" + page + "/" + subPage;
	}


	/**
	 * 后台管理溯源模块访问路径
	 */
	@RequestMapping("/admin/traceability/{module}/{page}")
	public String accesstraceabilityPage(@PathVariable String module, @PathVariable String page) {
		return "traceability/" + module + "/" + page;
	}

	/**
	 * 后台管理溯源模块访问路径
	 */
	@RequestMapping("/admin/traceability/{module}/{page}/{subPage}")
	public String accesstraceabilitySubPage(@PathVariable String module, @PathVariable String page, @PathVariable String subPage) {
		return "traceability/" + module + "/" + page + "/" + subPage;
	}

	/**
	 * 后台管理内容管理模块访问路径
	 */
	@RequestMapping("/admin/cms/{module}/{page}")
	public String accesscontentSubPage(@PathVariable String module, @PathVariable String page) {
		return "cms/" + module + "/" + page;
	}

	/**
	 * 后台管理农业电商模块访问路径
	 */
	@RequestMapping("/admin/agriecom/{module}/{page}")
	public String showAgriecomPage(@PathVariable String module, @PathVariable String page){
		return "agriecom/"+module+"/"+page;
	}

	/**
	 * 后台管理农技模块访问路径
	 */
	@RequestMapping("/admin/agritech/{module}/{page}")
	public String accessAgritechPage(@PathVariable String module, @PathVariable String page) {
		return "agritech/" + module + "/" + page;
	}

	@RequestMapping("/admin/agritech/{module}/{page}/{subPage}")
	public String accessAgritechSubPage(@PathVariable String module, @PathVariable String page, @PathVariable String subPage) {
		return "agritech/" + module + "/" + page + "/" + subPage;
	}
}
